﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NotepadSharp.IO;

namespace NotepadSharp
{
    public partial class ExplorerUserControl : UserControl
    {
        private readonly FileExplorer _fileExplorer = new FileExplorer();

        public ExplorerUserControl()
        {
            InitializeComponent();
        }

        private void ExplorerUserControl_Load(object sender, EventArgs e)
        {
            _fileExplorer.CreateRoot(fileTreeView);
        }

        private void fileTreeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node.Nodes[0].Text == "")
                _fileExplorer.EnumerateDirectory(e.Node);
        }
    }
}
